package eventManager;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;

import controller.IController;
import controls.IMasterControl;

import utilities.Key;

public class EventPortal {
	
	private static EventManager eventManager;
	
	public EventPortal(EventManager eventManager) {
		EventPortal.eventManager = eventManager;
	}
	
	public static boolean queueEvent(AppEvent event) {		
		return eventManager.queueEvent(event);		
	}
	
	public static boolean trigger(AppEvent event) {
		return eventManager.trigger(event);
	}
	
	public static boolean procEvents(long maxMillis) {
		return eventManager.procEvents(maxMillis);
	}
	
	public static boolean abortEvent(AppEvent event, boolean allOfType) {
		return eventManager.abortEvent(event, allOfType);
	}
	
	public static void addControllerMapReference(HashMap<Key, IMasterControl> controlMap) {
		eventManager.addControlMapReference(controlMap);
	}
	
	public static boolean removeControllerMapReference(HashMap<Key, IMasterControl> controlMap) {
		return eventManager.removeControlMapReference(controlMap);
	}
	
	public static boolean addListener(IEventListener listener, Set<String> eventNames) {
		return eventManager.addListener(listener, eventNames);
	}
	
	public static boolean addListener(IEventListener listener, String eventName) {
		return eventManager.addListener(listener, eventName);
	}
	
	public static boolean delListener(IEventListener listener, String eventName) {
		return eventManager.delListener(listener, eventName);
	}
	
	public static boolean delListener(IEventListener listener, Set<String> eventNames) {
		return eventManager.delListener(listener, eventNames);
	}
	
//	public static void addCodeEventType(String eventName) {
//		eventManager.addCodeEventType(eventName);
//	}
	
	public static ArrayList<IEventListener> getListenerList(String eventName) {
		return eventManager.getListenerList(eventName);
	}
	
	public static Set<String> getTypeList() {
		return eventManager.getTypeList();
	}	
	
	public void setEventManager(EventManager eventManager) {
		EventPortal.eventManager = eventManager;
	}

}
